﻿CREATE PROCEDURE [dbo].[state_Note_ChangeRepoAgent]
	@NoteID int
AS
SET NOCOUNT ON

DECLARE @LoanID int
SELECT @LoanID = LoanID FROM t_Note WHERE ID = @NoteID

EXEC state_Repo_Init @LoanID

UPDATE R SET AgentUserName=N.DateDueBy
FROM         t_Repossession AS R INNER JOIN
                      t_Note AS N ON R.LoanID = N.LoanID
WHERE     (N.ID = @NoteID)
